package com.copera.cn.kaka.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.copera.cn.kaka.R;

public class PointPraiseTotalAdapter extends BaseAdapter {
	
	
	private List<String> items;
	
	private Context context;  
	  
    private LayoutInflater mInflater; 
   
    
   
 
  
   
   
    
	public PointPraiseTotalAdapter(List<String> arrayList, Context context){
		this.items = arrayList;
		this.context = context;
		
		
	}

	@Override
	public int getCount() {
		return items.size();
	}

	@Override
	public Object getItem(int position) {
		return items.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder = null;
		
		if(convertView == null){
			viewHolder = new ViewHolder();
			mInflater = LayoutInflater.from(context);
			convertView = mInflater.inflate(R.layout.item_point_praise_total, null);
			
			viewHolder.name = (TextView)convertView.findViewById(R.id.cs);
			viewHolder.imageView = (ImageView)convertView.findViewById(R.id.choose);
			
			convertView.setTag(viewHolder);
		}else{
			viewHolder = (ViewHolder)convertView.getTag();
			viewHolder.name = (TextView)convertView.findViewById(R.id.cs);
			viewHolder.imageView = (ImageView)convertView.findViewById(R.id.choose);
			
		}
		viewHolder.name.setText(items.get(position));
		return convertView;
	}
	
	private class ViewHolder{
		
		TextView  name;
		ImageView imageView;
		
		
		
	}
	
	public void addItem(String cartVO){
		if(cartVO != null){
			items.add(cartVO);
		}
	}
	
	public void clear(){
		items.clear();
	}
}
